export const say = () => {
    console.log('达哥好帅')
}

/**
 * 生成简单的uuid
 * @returns uuid
 */
export const generateSimpleUUID = () => {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        const r = Math.random() * 16 | 0,
            v = c === 'x' ? r : (r & 0x3 | 0x8)
        return v.toString(16)
    })
}

// 重置表单
export const resetForm = (formEl, obj) => {
    if (!formEl) return
    formEl.resetFields()
    // 清空对象的值
    Object.keys(obj).forEach(k => obj[k] = undefined)
}

// 从一个对象上把属性值复制到另一个对象上
// 对象的快速复制
export const objCoppy = (o1, o2) => {
    Object.keys(o2).forEach(k => {
        o2[k] = o1[k]
    })
}

// 弹窗
export const myConfrim = msg => {
    return ElMessageBox.confirm(
        msg,
        '警告',
        {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        })
}

// 是否保存账户密码
const REMEMBER_KEY = 'da_login_info'

// 获取保存的账户密码信息
export const getRememberInfo = () => {
    return JSON.parse(localStorage.getItem(REMEMBER_KEY)) || {}
}

// 保存的账户密码信息
export const setRememberInfo = (info) => {
    localStorage.setItem(REMEMBER_KEY, JSON.stringify(info))
}